<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>功能管理页面</title>
<link href="./css/style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" language="javascript">
<!--
	function viewFunction(){
		window.location.href = "./function.do?action=viewFunction";
		window.location.target = "main";
	}
	
	function addFunction(){
		window.location.href = "./function.do?action=preAddFunction";
		window.location.target = "main";
	}
	
	function updateFunction(id){
		window.location.href = "./function.do?action=preUpdateFunction&id="+id;
		window.location.target = "main";
	}
	
	function viewPermit(){
	window.location.href = "viewRolePermit.html";
	window.location.target = "main";
	}
	
	function addAction(functionId){
		window.location.href = "./action.do?action=preAddAction&functionId="+functionId;
		window.location.target = "main";
	}
	
	function updateAction(){
		window.location.href = "updateAction.html";
		window.location.target = "main";
	}
-->
</script>
</head>
<body>
	<a class="common_title">>> 您现在的位置：基础设置 >> 功能管理</a>
	
	<div class="tools">
		<c:if test="${isAddFunction != null}">
		<a class="save" href="javascript:addFunction();" title="新增业务功能" hidefocus="true">新增</a>&nbsp;&nbsp;
		</c:if>
	</div>
	
	<table class="table_style" style="text-align: center;">
		<tr>
			<td class="title">功能名称</td>
			<td class="title">上级功能</td>
			<td class="title">是否有效</td>
			<td class="title">操作</td>
		</tr>
		<c:forEach var="function" items="${functions}">
		<c:if test="${function.parentId == 0}">
		<tr>
			<td><font color="red">${function.functionName}</font></td>
			<td>-</td>
			<td>
				<c:choose>
					<c:when test="${function.activity == 1}">是</c:when>
					<c:otherwise>否</c:otherwise>
				</c:choose>
			</td>
			<td>
				<img class="btn_img" src="./images/a_view.gif" onclick="viewFunction()" title="查看">&nbsp;&nbsp;
				<img class="btn_img" src="./images/a_update.gif" onclick="updateFunction(${function.id})" title="修改">&nbsp;&nbsp;
				<img class="btn_img" src="./images/a_del.gif" onclick="" title="删除">&nbsp;&nbsp;
			</td>
		</tr>
		<c:forEach var="sFunction" items="${functions}">
		<c:if test="${sFunction.parentId == function.id}">
		<tr>
			<td>${sFunction.functionName}</td>
			<td>基础设置</td>
			<td>
				<c:choose>
					<c:when test="${function.activity == 1}">是</c:when>
					<c:otherwise>否</c:otherwise>
				</c:choose>
			</td>
			<td>
				<img class="btn_img" src="./images/a_view.gif" onclick="viewFunction()" title="查看">&nbsp;&nbsp;
				<img class="btn_img" src="./images/a_update.gif" onclick="updateFunction(${sFunction.id})" title="修改">&nbsp;&nbsp;
				<img class="btn_img" src="./images/a_del.gif" onclick="" title="删除">&nbsp;&nbsp;
				<img class="btn_img" src="./images/a_addaction.gif" onclick="addAction(${sFunction.id})" title="新增操作">&nbsp;&nbsp;
				<img class="btn_img" src="./images/a_updateaction.gif" onclick="updateAction()" title="修改操作">&nbsp;&nbsp;
			</td>
		</tr>
		</c:if>
		</c:forEach>
		</c:if>
		</c:forEach>
	</table>
	
	<!-- page 
	<table class="table_page" cellpadding="0" cellspacing="0">
		<tr>
			<td class="title">
			</td>
			<td class="title">
				总共<%=request.getAttribute("countPage")%>页,
				第<%=request.getSession().getAttribute("currentPage")%>页&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
				<a href="./function.do?action=display&flag=1" target="main" hidefocus="true">第一页</a>&nbsp;&nbsp;&nbsp;&nbsp;
				<a href="./function.do?action=display&flag=2" target="main" hidefocus="true">上一页</a>&nbsp;&nbsp;&nbsp;&nbsp;
				<a href="./function.do?action=display&flag=3" target="main" hidefocus="true">下一页</a>&nbsp;&nbsp;&nbsp;&nbsp;
				<a href="./function.do?action=display&flag=4" target="main" hidefocus="true">最后一页</a>
			</td>
			<td class="title"></td>
		</tr>
	</table>
	-->
</body>
</html>